package one.three.twentyEight;

public class MaxBeta {

	private static class Node<Item> {
		private Item item;
		private Node next;

		@Override
		public String toString() {
			return "[" + item + "]";
		}
	}

	public static int max(Node<Integer> n) {
		if (n == null)
			return 0;
		if (n.next == null)
			return n.item;
		int m = max(n.next);
		if (n.item > m)
			return n.item;
		else
			return m;
	}

	public static void main(String[] args) {
		Node<Integer> f = new Node<Integer>();
		f.item = 0;
		Node<Integer> c = f;
		for (int i = 1; i <= 10; i++) {
			c.next = new Node<Integer>();
			c.next.item = i;
			c = c.next;
		}

		c = f;
		while (c != null) {
			System.out.println(c.item);
			c = c.next;
		}
		int max = max(f);
		System.out.println(max);
	}

}
